package com.hskn.hss.module.videofile.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hskn.hss.module.videofile.entity.VideoFile;
import com.hskn.hss.module.videofile.mapper.VideoFileMapper;
import com.hskn.hss.module.videofile.service.IVideoFileService;
import com.hskn.hss.module.videofile.to.VideoFileTO;
import com.hskn.hss.module.videofile.vo.VideoFileVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 录像文件
 *
 * @author lny
 * @date 2021-11-18
 */
@Service
public class VideoFileServiceImpl extends ServiceImpl<VideoFileMapper, VideoFile> implements IVideoFileService {
    @Resource
    private VideoFileMapper videoFileMapper;

    @Override
    public VideoFile selectById(String id) {
        return videoFileMapper.selectById(id);
    }

    @Override
    public List<VideoFileVO> list(VideoFileTO videoFileTO) {
        String createTimeOrder = videoFileTO.getCreateTimeOrder();
        if (!"desc".equals(createTimeOrder) && !"asc".equals(createTimeOrder)) {
            throw new RuntimeException("createTimeOrder参数传值错误");
        }
        List<VideoFileVO> list = videoFileMapper.list(videoFileTO);
        return list;
    }

}
